1. Field of the Invention
This invention relates to instruction set architectures for computer processors. More particularly, the invention relates to generalized bit manipulation instructions.
2. Background of the Invention
Many computer applications rely on the computation of certain elementary mathematical functions. Examples of such functions include square root functions, logarithm functions, exponential functions, and so forth. Certain applications, such as numerical applications, high performance computing applications, scientific computing applications, and financial applications are particularly reliant on the computation of elementary functions to the point that the efficiency with which such functions are evaluated significantly impacts the overall performance of such applications.
A great deal of effort is dedicated to optimizing computation of elementary functions. Two important techniques for the optimization of such computations include the use of piecewise polynomial approximations and bit manipulation. Bit manipulation can be used to facilitate such approximations, as described below.
In the piecewise polynomial approximation technique, a number of polynomials are defined. Each defined polynomial approximates the target function, which may be an elementary function, accurately over a specific interval. Coefficients for these polynomials are stored in a table, along with other values used in the approximation.
To access the relevant polynomial coefficients from the table, a key is generated. To select the appropriate polynomial coefficients corresponding to the appropriate interval, the key is produced by extracting and/or manipulating bits from the argument, or an intermediate value computed from the argument. The argument or other value from which the key is computed is typically a floating point value, whose bits are typically a combination of a subset of the sign, exponent and fraction bits. Therefore, the ability to efficiently manipulate argument bits is essential to the efficient calculation of performance critical elementary functions.
By use of a piecewise polynomial approximation technique based on bit manipulation, high performance computing applications that repetitively rely on elementary function can be efficiently implemented. In addition to the use of bit manipulation in forming table-lookup keys, bit manipulation also can be used in other ways, such as copying a sign bit, or moving exponent bits to the fraction bits of a floating-point number to calculate an approximate base-2 logarithm. Additionally, bit manipulation is also important for applications such as encryption, databases (packing fields), compression, video/audio encoding/decoding, and spline interpolation. The ability to manipulate bits is also important to other processes in rendering, computer graphics, and calculating hash functions.
Often high-throughput applications, including applications that rely heavily on elementary functions, also rely on parallel computing such as Single Instruction, Multiple Data (SIMD) for optimum performance. However, instruction set architectures do not presently support instructions for the kind of bit manipulations necessary to manipulate bits for the purposes of elementary function calculation as efficiently as they could. Furthermore, currently existing instructions, such as the Rotate Left Word Immediate then Mask Insert (rlwimi) of the POWER instruction set architecture, which is not supported for SIMD or floating point data, are not sufficiently general. As a result, multiple operations must often be performed to manipulate bits as required for elementary function calculation. Therefore, additional instructions need to be defined that are capable of bit manipulation with greater generality and which are supported for SIMD and which support floating point data.